<!--
 * @Author: MrLee
 * @Date: 2024-08-24 10:19:44
 * @LastEditors: MrLee
 * @LastEditTime: 2024-09-03 06:15:18
 * @Description: 请填写简介
-->
<template>
    <custom-navbar title="求职偏好(6)" :auto-back="true" left-icon-color="#303133" />
    <up-gap height="30rpx" />
    <view class="bg-#f6f7f8 px-22rpx">
        <view @click="onPreference(item)" v-for="(item, index) in list" :key="index"
            class="job-item mb-32rpx  items-center rounded-[20rpx] bg-#fff px-40rpx py-24rpx shadow-[0px_6px_16px_0px_rgba(191,191,191,0.26)]">
            <view style="border-bottom: 1px solid #cecece" class="mb-18rpx pb-18rpx" @click="addPreFuc(item)">
                <view class=" px-20rpx py-10rpx bg-#f7f7f8 inline-block rounded-[28rpx] text-[#7b7b7b] text-[24rpx]"><view class="inline-block iconfont icon-bianji"></view>重命名</view>
            </view>
            <view class="flex flex-col justify-center">
                <view class="mb-14rpx flex items-center justify-between">
                    <view class="text-left text-[32rpx] text-[#1d2129]">
                       {{ item.cutType }} | {{ item.name }}
                    </view>
                </view>
                <view class="flex items-center text-left text-[26rpx] text-[#6e6d72]">
                    <view v-for="(itemTab, indexTab) in item.tabs" :key="indexTab"
                        class="flex items-center justify-center">
                        <view>{{ itemTab.label }}</view>
                        <view v-if="indexTab !== item.tabs.length - 1" class="mx-10rpx h-28rpx w-2rpx bg-#6e6d72" />
                    </view>
                    <view class="flex  items-center justify-end flex-1 text-right text-[#999999]  text-[24rpx]"><view class="iconfont icon-fuzhi" @click="addPreFuc(item, 1)"></view>复制</view>
                </view>
            </view>

        </view>
    </view>
    <view class="fixed bottom-0 h-178rpx w-[100%] bg-#fff shadow-[0px_0px_12px_0px_rgba(238,239,241,0.50)]">
        <view @click="addPreFuc"
            class="mx-auto my-0 mt-[24rpx] h-82rpx w-[90%] rounded-[42rpx] bg-#1f50f2 text-center text-[30rpx] text-white font-medium leading-[82rpx]">
            添加求职偏好
        </view>
    </view>
</template>

<script setup lang="ts">
// import userCatch01 from '@/static/images/tab/user-header.png';
import { userIntentionList } from '@/api/user';
const userCatch01 = "https://yiliao.test03.qcw800.com/static/images/tab/user-header.png";
let list:any = ref([]);
let type = 0;

const onPreference = (item) => {
    if (type == 1) {
        console.log(item);
        uni.setStorageSync('preferenceId', item.id);
        uni.navigateBack({ delta: 1 })
    }
}

const addPreFuc = (item, type) => {
    uni.navigateTo({
        url: "/pages/tab/home/more/addPre?id=" + item.id + "&type=" + type,
    });
}
async function getIntentionList() {
    let result = await userIntentionList();
    console.log('求职偏好经历列表 res list:::', result);
    list.value = []
    result.map(v => {
      list.value.push({
        id: v.id,
        name: v.province.name+'·'+v.city.name,
        cutType:v.nature,
        headerUrl: '',
        tabs: [
            {
                label: v.position.p_content+'·'+v.position.content,
                ico: 'icon-a-zu121328_1',
            },
            {
                label: v.salary_min/1000+'k-'+v.salary_max/1000+'k',
            }
        ]
      })
    })
}
onLoad((options) => {
    type = options.type || 0;
})
onShow(() => {
    getIntentionList();
  console.log('进来了-=----------')

});
</script>
